<?php
$dsn = "mysql:host=localhost;dbname=zsj_guestbook";
try{
	$db=new PDO($dsn, 'root', '123456');
	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);//以异常形式报错
	$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE , PDO::FETCH_ASSOC );//返回数组
}catch(PDOException $e){
	throw $e;
	echo "Failed to connect database";
	die;
}
?>
